package myJs.myPkg

import myJs.myPkg.jquery.JQuery
import myJs.myPkg.jsext._

import scala.scalajs.js
import scala.language.implicitConversions
import scala.scalajs.js.JSConverters._


/**
 * Created by yz on 2019/3/14
 */

@js.native
trait Multiselect extends js.Object {

  def $left:JQuery = scalajs.js.native

  def $right:JQuery = scalajs.js.native


}

@js.native
trait MultiSelectJQuery extends js.Object {

  def multiselect(options: MultiSelectOptions): JQuery = scalajs.js.native

}

object MultiSelectOptions extends MultiSelectOptionsBuilder(noOpts)

class MultiSelectOptionsBuilder(val dict: OptMap) extends JSOptionBuilder[MultiSelectOptions, MultiSelectOptionsBuilder](new MultiSelectOptionsBuilder(_)) {

  def right(v: String) = jsOpt("right", v)

  def rightSelected(v: String) = jsOpt("rightSelected", v)

  def leftSelected(v: String) = jsOpt("leftSelected", v)

  def rightAll(v: String) = jsOpt("rightAll", v)

  def leftAll(v: String) = jsOpt("leftAll", v)

  def moveToRight(v: js.Function) = jsOpt("moveToRight", v)

  def moveToLeft(v: js.Function) = jsOpt("moveToLeft", v)

  def keepRenderingSort (v: Boolean) = jsOpt("keepRenderingSort ", v)

  def sort(v: Boolean) = jsOpt("sort", v)

  def moveUp(v: String) = jsOpt("moveUp", v)

}

trait MultiSelectOptions extends js.Object {

}


trait MultiSelectJQueryImplicits {
  implicit def implicitMultiSelectJQuery(jq: JQuery) = {
    jq.asInstanceOf[MultiSelectJQuery]
  }
}
